package com.my.learn.thread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class MyCallable implements Callable {

    private int i;

    public MyCallable(int i) {
        this.i = i;
    }

    @Override
    public String call() throws Exception {
        return Thread.currentThread().getName() + " MyCallable "+i;
    }

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable callable = new MyCallable(1);
        FutureTask ft = new FutureTask(callable);
        Thread thread = new Thread(ft);
        thread.start();
        System.out.println(ft.get());
    }

}
